home *** CD-ROM | disk | FTP | other *** search
-
-
- #ifndef __SCENETEXTURE_H_
- #define __SCENETEXTURE_H_
- /*
- Peon - Win32 Games Programming Library
- Copyright (C) 2002-2005 Erik Yuzwa
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with this library; if not, write to the Free
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
- Erik Yuzwa
- peon AT wazooinc DOT com
- */
-
-
- #include "IUnknown.h"
-
- #include <SDL_image.h>
-
-
- namespace peon
- {
- /**
- * This object encapsulates the "magic" behind loading and manipulating
- * texture data. Right now, it's a very simplistic container but
- * to start with, that's all we need. It can handle any image format
- * supported by the SDL_Image helper library. For the most part, I usually
- * try to stick with BMP's, TGA's and PNG's.
- */
- class PEONMAIN_API SceneTexture : public IUnknown
- {
- protected:
- /** OpenGL-specific texture handle */
- GLuint m_tex;
-
- protected:
- /**
- * Method to scan the surface at particular coordinates to
- * grab the pixel data
- * @param surface - SDL_Surface object to work with
- * @param x - x coordinate
- * @param y - y coordinate
- * @return Uint32 - unsigned integer representing pixel info
- */
- Uint32 getPixel(SDL_Surface *surface, int x, int y);
-
- public:
- /**
- * Constructor
- */
- SceneTexture();
-
- /**
- * Destructor
- */
- ~SceneTexture();
-
- /**
- * This method loads the image into this object and
- * gets everything correctly configured for use in the
- * pipeline
- * @param strFilename - filename of texture
- * @param bAlpha - do we want the alpha channel?
- * @param bMipMaps - do we want to create mipmaps?
- * @param bRepeat - do we want to repeat this texture?
- * @return bool - true if we're all ok
- */
- bool loadImage( const String& strFilename, bool bAlpha,
- bool bMipMaps, bool bRepeat );
-
- /**
- * This method just returns the handle to our texture data
- * @return GLuint - texture data handle
- */
- GLuint getTex(){ return m_tex; }
-
- };
- }
-
- #endif
-
-